package com.um.jdy.platform.month.controller;

import com.um.jdy.common.member.entity.vo.RechargePackageVO;
import com.um.jdy.platform.month.entity.dto.CardPackagePageDTO;
import com.um.jdy.platform.month.entity.vo.CardPackageItemVO;
import com.um.jdy.platform.month.manager.CardPackageManager;
import com.um.jdy.platform.recharge.entity.dto.PackagePageDTO;
import com.um.springboot.starter.annotation.ApiPermission;
import com.um.springboot.starter.annotation.TokenRequired;
import com.um.springboot.starter.entity.Page;
import com.um.springboot.starter.orm.controller.BasePlusController;
import com.um.springboot.starter.orm.entity.Response;
import com.um.springboot.starter.orm.params.ListDTO;
import com.um.jdy.common.month.service.CardPackageService;
import com.um.jdy.common.month.entity.po.CardPackage;
import com.um.jdy.common.month.entity.dto.CardPackageDTO;
import com.um.jdy.common.month.entity.vo.CardPackageVO;
import com.um.springboot.starter.orm.params.PageParams;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 控制器：月卡套餐表
 */
@RestController
@RequestMapping("/api/v1/cms/month/card_package")
@Api(tags = "月卡套餐表", description = "CardPackageController")
@ApiPermission("card_package")
@Validated
@TokenRequired
public class CardPackageController extends BasePlusController<CardPackageManager,CardPackageService,CardPackage,CardPackageDTO,CardPackageVO, CardPackagePageDTO, ListDTO> {

    /**
     * 分页查询月卡套餐
     *
     * @param params
     * @return
     */
    @ApiPermission("page")
    @ApiOperation("分页查询月卡套餐")
    @PostMapping("package_page")
    public Response<Page<CardPackageItemVO>> getPage(@RequestBody CardPackagePageDTO params) {
        PageParams pageParams = params.toPageParams(new String[]{"name"},new String[]{"p.name"});
        return manager.getPage(pageParams);
    }

}
